package com.smomo.blog.controller.front;
import com.smomo.blog.annotation.AccessLimit;
import com.smomo.blog.common.ResponseResult;
import com.smomo.blog.dto.EmailLoginDTO;
import com.smomo.blog.service.front.ApiUserService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RestController
@RequestMapping("/oauth")
@RequiredArgsConstructor
public class ApiJustAuthController {
    private  final ApiUserService userService;

    @AccessLimit
    @RequestMapping(value = "/emailLogin",method = RequestMethod.POST)
    @ApiOperation(value = "账号密码登录", httpMethod = "POST", response = ResponseResult.class, notes = "账号密码登录")
    public ResponseResult emailLogin(@Valid  EmailLoginDTO emailLoginDTO){
        return userService.emailLogin(emailLoginDTO);
    }
}
